<div ng-controller="templateStrategyDetailController">
    <div class="row">
        <div class="col-sm-12 condensed-list">
            <form name="templateStrategyDetailForm" class="form-inline" role="form" novalidate>
                <ul class="list-group">
                    <li class="list-group-item">
                        <i class="glyphicon glyphicon-plus" ng-class="templateStrategy.$closed ? 'glyphicon-plus' : 'glyphicon-minus'" ng-click="templateStrategy.$closed =!templateStrategy.$closed;"></i>
                        <label>生成策略</label>
                        <div class="input-group">
                            <span class="input-group-addon text-info">ID</span>
                            <span class="input-group-addon">{{templateStrategy.id}}</span>
                        </div>
                        <div class="input-group">
                            <span class="input-group-addon text-info">name</span>
                            <span class="input-group-addon">{{templateStrategy.name}}</span>
                        </div>
                        <ul ng-init="parent=templateStrategy;" ng-include="'recursion'" class="list-group" ng-show="!templateStrategy.$closed && templateStrategy.children.length"></ul>
                    </li>
                </ul>
            </form>
            <br/>
            <form class="form-horizontal" role="form" novalidate>
                <div class="form-group">
                    <div class="col-sm-3 col-sm-offset-5">
                        <div class="btn-group">
                            <button type="button" class="btn btn-primary btn-sm" location-back>返回</button>
                            <button type="button" ng-disabled="templateStrategy.developer.id != $security$.user.id" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></button>
                            <ul class="dropdown-menu">
                                <li><a href="javascript:void(0);" location-go="/business/templateStrategy/update/{{templateStrategy.id}}">修改</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="javascript:void(0);" ng-click="delete(templateStrategy)">删除</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script id="recursion" type="text/ng-template">
    <li class="list-group-item" ng-repeat="child in parent.children" ng-init="formatTag(child);">
        <i class="glyphicon glyphicon-plus" ng-class="child.children.length ? (child.$closed ? 'glyphicon-plus' : 'glyphicon-minus') : 'glyphicon-leaf'" ng-click="child.$closed =! child.$closed;"></i>
        <label>{{child.tagName}}</label>
        <div class="input-group" ng-repeat="attribute in tagRules[child.tagName].attributes" style="margin-right: 4px;">
            <span class="input-group-addon text-info">{{attribute.name}}</span>
            <span class="input-group-addon">{{child[attribute.name]}}</span>
        </div>
        <ul class="list-group" ng-include="'recursion'" ng-show="!child.$closed && child.children.length" ng-init="parent=child;"></ul>
    </li>
</script>